package com.longge;

/**
 * @program: my-code
 * @description:
 * @author: longge
 * @create: 2021-04-30 02:26
 */
public class Gain {

    public int largestAltitude(int[] gain) {
        int max = Math.max(0, gain[ 0]);
        for (int i = 1; i < gain.length; i++) {
            gain[i] = gain[i - 1] + gain[i];
            max = Math.max(max, gain[i]);

        }
        return max;
    }
}
